// 记分牌类
class ScorePanel{
    score=0;
    level=1;

    scoreEle:HTMLElement;
    levelEle:HTMLElement;

    maxLevel:number;// 最大等级
    upScore:number;// 升级分数

    constructor(maxLevel:number=10,upScore:number=10){
        this.scoreEle=document.getElementById('score')!;
        this.levelEle=document.getElementById('level')!;
        this.maxLevel=maxLevel;
        this.upScore=upScore;
    }

    addScore(){
        this.scoreEle.innerHTML=++this.score+'';
        // 每10分升一级
        if(this.score%this.upScore===0){
            this.addLevel();
        }
    }
    addLevel(){
        if(this.level<this.maxLevel){
            this.levelEle.innerHTML=++this.level+'';
        }
    }
}


export default ScorePanel;